package com.eps.sumi;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;


/**
 * Handles requests for the application home page.
 */
@Controller
public class VistasSimplesController {


	private static final Logger logger = LoggerFactory.getLogger(VistasSimplesController.class);

	/**
	 * Simply selects the home view to render by returning its name.
	 */
	
	
	public String home1(HttpServletRequest request,HttpServletResponse response){
		return "home";
	}
	

	@RequestMapping(value="/menu", method=RequestMethod.GET)
	public String menu() {
		logger.info("Welcome index!");
		return "menuContent";
	}
	
	
	
	@RequestMapping(value="/frmpedidos", method=RequestMethod.GET)
	public String frrmpedidos() {
		logger.info("Welcome home!");
		return "formulario";
	}
	
	
	@RequestMapping(value="/movil", method=RequestMethod.GET)
	public @ResponseBody /*Map<String, ? extends Object>*/ List<Cliente> getProvider(@RequestParam String codigo) {
		logger.info(codigo);	
		/* Map<String, Object> myModel = new HashMap<String, Object>();
        myModel.put("id", "prueba");
        myModel.put("cliente", new Cliente("001","lui angel"));
        return myModel;*/
		List<Cliente> clientes = new ArrayList<Cliente>(1);
		clientes.add(new Cliente("001","lui angel"));
		clientes.add(new Cliente("002","aldo renato"));
		clientes.add(new Cliente("003","ricado hernan"));
		return clientes;

	}	

	
}

